﻿using Architecture.Api.Application.Command.UserCommand;
using Architecture.Domain.Dto;
using Architecture.Service;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.UserHandler
{
    public class UserShowCommandHandler : IRequestHandler<UserShowCommand,PageListDto<UserListDto>>
    {
        private readonly IUserService _userService;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userService"></param>
        public UserShowCommandHandler(IUserService userService)
        {
            _userService = userService;
        }

        public async Task<PageListDto<UserListDto>> Handle(UserShowCommand request, CancellationToken cancellationToken)
        {
            return await _userService.GetAllAsync(request.pageIndex, request.pageSize,request.userName);
        }
    }
}
